<html>
<head>
<title>Test API</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<!-- <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.1.min.js"></script> -->
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
	function sendRequest(){
		var request_url = $.trim($('#request_url').val());
		var request = $.trim($('#request_xml').val());

		$('#request_button').attr('disabled', 'disabled');
		$('#response_xml').val('');
		
		$.ajax({
			   type: "POST",
			   url: request_url,
			   data: {
					'request': request
			   },
			   dataType: 'text',
			   error: function(){
				   alert('请求错误');
				   $('#request_button').removeAttr('disabled');
				},
			   success: function(response){
					$('#response_xml').val(response);
					$('#request_button').removeAttr('disabled');
			   }
			});
	}
</script>

</head>
<body>

	<div style="width: 800px;">
		<div name="request_url" style="margin-top: 20px;">
			<div style="font-weight: bold;">请求地址:&nbsp;</div>
			<div><input id="request_url" type="text" value="index.php?m=movie&a=hot_play" style="width:500px;"/></div>
		</div>
	
		<div name="request_xml" style="margin-top: 20px;">
			<div style="font-weight: bold;">请求数据:&nbsp;
				<button id="request_button" onclick="sendRequest()">Send Request</button>&nbsp;
			</div>
			<div>
				<textarea id="request_xml" rows="15" cols="100"></textarea>
			</div>
		</div>
	
		<div name="response_xml" style="margin-top: 20px;">
			<div style="font-weight: bold;">响应数据:&nbsp;</div>
			<div><textarea id="response_xml" rows="30" cols="100"></textarea></div>
		</div>
	</div>

</body>
</html>